package com.example.web_project_xianyu.mappers;

import com.example.web_project_xianyu.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface userMapper {

    @Insert("insert into user_table(user_name, password) values(#{userName}, #{password})")
    @Options(useGeneratedKeys = true,keyProperty = "userId")
    void insert_user(User user);

    @Select("select * from user_table where user_name = #{user_name}")
    User select_by_name(String user_name);

    @Select("select * from user_table where user_id = #{user_id}")
    User select_by_id(int user_id);

    @Select("select * from user_table")
    List<User> select_all();

}
